package Server;

import XML.XML;
import XML.XMLNode;

/**
 * 广播消息类
 * 
 * @author SkyWind
 * 
 */
public class Message {
	public static final int ALL = 10;// 全局
	public static final int OUTERNET = 1;// 外网
	public static final int LAN = -1;// 内网
	public static final int COMMON = 0;// 通用(按照群名称，*表示所有在线用户)
	public int type;// 广播类型
	public XML msg;// 广播内容
	public int GroupID;// 群数据库编号，type:COMMON

	public Message(String msg, int type) {
		this(new XML(msg), type);
	}

	public Message(XML msg, int type) {
		this.msg = msg;
		this.type = type;
		msg.put("msg_type", type);
	}

	public Message(XMLNode msg, int type) {
		this(msg.toString(), type);
	}

	@Override
	public String toString() {
		return "[广播]type:" + (type == OUTERNET ? "Outer net" : type == LAN ? "LAN" : "COMMON") + " Message:" + msg;
	}
}